package com.example.common.view.provider

import android.content.Context
import com.alibaba.android.arouter.facade.annotation.Route
import com.example.base.path.RouterPath
import com.example.common.view.entity.UserInfo
import com.tencent.mmkv.MMKV

/**
 * 提供登录相关服务
 */
//@Route(path = RouterPath.PATH_COMMON_PROVIDER,name="对外暴露基础服务")
abstract class BaseServiceProvider : IBaseServiceProvider {
    private lateinit var mContext:Context
    override fun init(context: Context?) {
        context?.let {
            mContext=it
        }
    }
    override fun checkLoginState(): Boolean {
        val loginToken= MMKV.defaultMMKV().decodeString("token", "")
        if(!loginToken.isNullOrEmpty()) {
            return true
        }
        return false
    }

    override fun getLoginToken(): String {
        return MMKV.defaultMMKV().decodeString("token", "").toString()
    }

    override fun getCurrentUserInfo(): UserInfo {
        return UserInfo("张三")
    }

}